<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
<meta name="decorator" content="moduleView" />
<script src="${staticPath}/lib/accounting/0.3.2/accounting.min.js"
	type="text/javascript"></script>
<script src="${staticPath}/lib/printPage/jquery.printPage.js"
	type="text/javascript"></script>
<script type="text/javascript">
	function getUrl(url,iframeId) {
		var frame = $("#"+iframeId);
		if(!frame.attr("src")){
			frame.attr("src", url);
		}
	}

	function printme() {
		document.body.innerHTML = document.getElementById('home').innerHTML;
		window.print();
	}

	$(document).ready(function() {
		$('[data-accounting]').each(function() {
			var $this = $(this);
			if ($this.attr("data-accounting-precision") && "" != $this.attr("data-accounting-precision")) {
				$this.html(accounting.formatMoney($this.attr("data-accounting"),"¥ ",
								$this.attr("data-accounting-precision") * 1));
				} else {
					$this.html(accounting.formatMoney(
							$this.attr("data-accounting"),"¥ "));
				}
			});
		$('[data-accounting-ratio]').each(function() {
			var $this = $(this);
			var number = $this.attr("data-accounting-precision");
			var options = {
					symbol : "%",
					decimal : ".",
					thousand: ",",
					precision : 2,
					format: "%v %s"
				};
			$this.html(accounting.formatMoney(number,options));
		});
		
		if("${active}"=="statementError"){
			$('#counterTab a[href="#errorStatement"]').tab('show');
		}
		/* $(".btnPrint").printPage(); */
	});
</script>
</head>
<body>
		<div class="Report_f">
	        <div class="Report_f_1">
	             <div class="Report_f_title_1">联营结算单</div>
	        	 <div class="o-l-action">
					<a class="btn btn-default btn-sm btn_5 pull-right" role="button" href="javascript:void(0)" onclick="history.go(-1)">返回</a> 
					<a class="btn btn-primary btn-sm btn_5 pull-right btnPrint" role="button" href="${contextPath}/biz/statement/stm/counter/${stmCounter.id}/print?billNo=${stmCounter.billNo}&companyCode=${stmCounter.companyCode}&year=${stmCounter.year}" target="_blank">打印</a> 
					<%-- <c:if test='${flag=="1"}'> --%><shiro:hasPermission name="com.maoye.ossp.biz.statement.BizStatementStmCounter:add"><c:if test='${stmCounter.isReconciliation=="2"||stmCounter.isReconciliation=="1"}'><a class="btn btn-primary btn-sm btn_5 pull-right" role="button" href="${contextPath}/biz/statement/stm/counter/${stmCounter.id}/addInvoice" target="_self">我要开票</a>
					</c:if></shiro:hasPermission> <%-- </c:if>  --%>
					<%-- <a class="btn btn-warning btn-sm btn_5 pull-right" role="button" href="${contextPath}/biz/statement/stm/error/add?billNo=${stmCounter.billNo}&statementType=LJ00"><span
					class="glyphicon glyphicon-exclamation-sign"></span>录入异常</a>  --%>
<%-- 					<a class="btn btn-success btn-sm pull-right" role="button" href="${contextPath}/statement/stm/counter/${stmCounter.billNo}/confirm">确认对账</a> --%>
				</div>
	             <div class="tab-content Report_f_title_3">
	                  <div class="Report_f_title_5">
                           <div class="col-sm-2 leftbar_1">
                                <ul class="nav Report_f_title_6">
                                   <li><a href="#label_1" data-toggle="tab">详细信息</a></li>
                                  <%--  <li><a href="#label_2" data-toggle="tab" onclick="getUrl('${contextPath}/biz/statement/stm/error/showStatementErrorList?statementType=LJ00&billNo=${stmCounter.billNo}','errorStatementFrame')">结算异常</a></li> --%>
                                   <!-- <li><a href="#label_4" data-toggle="tab">自营单据</a></li> -->
                                </ul>
                           </div>
	                       <div class="tab-content Report_f_title_3">
	                            <div class="tab-pane active" id="label_1">
	                                 <div class="Report_f_title_4">
	                                      <div class="f_3">
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">结算单号:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14">${stmCounter.billNo}</div>
	                                             </div>
	                                         </div>
	                                          <div class="form-group col-sm-6">
	                                          <label for="inputtext3" class="col-sm-4 control-label f_4">供应商名称:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14">${stmCounter.supplierName}</div>
	                                             </div>
	                                         </div>
	                                      </div>
	                                       <div class="f_3">
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">供应商编号:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14">${stmCounter.supplierNo}</div>
	                                             </div>
	                                         </div>
	                                          <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">公司名称:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14">${stmCounter.companyName}</div>
	                                             </div>
	                                         </div>
	                                      </div>
	                                      <div class="f_2">
	                                         <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_7">结算期间:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <fmt:formatDate value="${stmCounter.startTime}" pattern="yyyy-MM-dd" />&nbsp;&nbsp;至&nbsp;&nbsp;<fmt:formatDate value="${stmCounter.endTime}" pattern="yyyy-MM-dd" />
	                                             </div>
	                                         </div>
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">供应商合同号:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  ${stmCounter.contractNumber}
	                                             </div>
	                                         </div>
	                                      </div>
	                                      <div class="f_3">
	                                         <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_7">会员卡折让金额:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14">${stmCounter.vipDiscount}</div>
	                                             </div>
	                                         </div>
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">本期合同成本:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14"><fmt:formatNumber
												value="${stmCounter.contractCost}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></div>
	                                             </div>
	                                         </div>
	                                      </div>
	                                      <div class="f_2">
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">本期折扣分摊:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14"><fmt:formatNumber
												value="${stmCounter.discountAllocation}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></div>
	                                             </div>
	                                         </div>
	                                         <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_7">本期实际成本:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14"><fmt:formatNumber
												value="${stmCounter.actualCost}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></div>
	                                             </div>
	                                         </div>
	                                      </div>
	                                      <div class="f_3">
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">本期扣款:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14"><fmt:formatNumber
												value="${stmCounter.deductMoney}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></div>
	                                             </div>
	                                         </div>
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">本期实付金额:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14"><fmt:formatNumber
												value="${stmCounter.amountPaid}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></div>
	                                             </div>
	                                         </div>
	                                      </div>
	                                       <div class="f_3">
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">本期返利金额:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14"><fmt:formatNumber
												value="${stmCounter.bebate}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></div>
	                                             </div>
	                                         </div>
	                                        <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_4">本期销售额:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14"><fmt:formatNumber
												value="${stmCounter.sales}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></div>
	                                             </div>
	                                         </div>
	                                      </div>
	                                       <div class="o-l-search-builder f_9">
												<h4>
													扣款明细
												</h4>
												<table class="table table-striped table-hover o-l-table table-bordered">
													<thead class="t_1">
														<tr>
															<th style="width: 200px">扣款项目</th>
															<th style="width: 120px">扣款金额</th>
															<th style="width: 120px">实扣金额</th>
															<th>备注</th>
														</tr>
													</thead>
													<tbody>
														<c:forEach items="${stmCounter.statementPaymentDetails}" var="itemCode" varStatus="var">
															<tr>
																<td>${itemCode.costName}</td>
																<td><fmt:formatNumber
												value="${itemCode.shouldDeductAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
																<td><fmt:formatNumber
												value="${itemCode.realDeductAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
																<td>${itemCode.auditingRemark}</td>
															</tr>
														</c:forEach>
													</tbody>
												</table>
											</div>
	                                 </div>
	                            </div>
	                            <div class="tab-pane" id="label_2">
	                            	<iframe id="errorStatementFrame" name="errorStatementFrame"
										scrolling="no" frameborder="no" width="100%"></iframe>
	                            </div>
	                            <div class="tab-pane" id="label_4">
									<iframe id="saleListFrame" name="saleListName" scrolling="no"
										frameborder="no" width="100%"></iframe>
	                            </div>
	                        </div>
	                  </div>
	             </div>
	        </div>
	   </div>  
</body>
</html>